#ifndef PROJECTHANDLE_H
#define PROJECTHANDLE_H

#include <QObject>
#include<QString>
#include<QDomDocument>
#include<QList>
#include<QMap>
#include<QDebug>
#include<QFile>
#include<QDomElement>

/**
 * @brief The ProjectHandle class
 * load、save project
 */
class Event;
class ProjectHandle : public QObject
{
    Q_OBJECT
public:
    explicit ProjectHandle(QObject *parent = 0);

    void setXmlPath(QString XmlPath);
    void setCurrentMdlIndex(int CurrentMdlIndex);
    void addMdlFilePath(QString MdlFilePath);
    void setModelType(QString ModelType);
    void setModelFilePath(QString ModelFilePath);
    void setModelFileRelativePath(QString ModelFileRelativePath);
    void setInputParameter(QString InputParameter);
    void setLicense(QString);

    void addEvent(Event *PEvent);
    void addLibrary(QString );
    void addHardwareCondition(QString Key,QString Value);
    void addSoftwareEnvironment(QString Key,QString Value);
    void addTestifyPath(QString);
    void addSupportive(QString);

    bool LoadFromFile(QString XmlPath);
    bool SaveToFile(QString XmlPath);


    QString getXmlPath();
    int     getCurrentMdlIndex();
    QString getMdlFilePath(int index);
    int     getMdlFileCount();
    QString getModelType();
    QString getModelFilePath();
    QString getModelFileRelativePath();
    QString getInputParameter();
    Event * getEvent(int index);
    int     getEventCount();
    QString getLibrary(int index);
    int     getLibraryCount();
    QMap<QString,QString> *getHardwareCondition();
    QMap<QString,QString> *getSoftwareEnvironment();
    QString getTestifyPath(int index);
    int     getTestifyPathCount();
    QString getSupportivePath(int index);
    int     getSupportivePathCount();
    QString getLicenseName();



signals:

public slots:
private:
    QString mXmlPath="";

        //Model Preview
    int mCurrentMdlIndex=0;
    QList<QString> *mMdlFilePathList = NULL;

        //Model Pack
    QString mModelType="";
    QString mModelFilePath = "";
    QString mModelFileRelativePath = "";
    QString mInputParameter = "";
    QList<Event *>* mEventList=NULL;
    QList<QString >* mLibraryList=NULL;
    QMap<QString,QString> *mHardwareCondition=NULL;
    QMap<QString,QString> *mSoftwareEnvironment=NULL;
    QList<QString> *mTestifyPathList=NULL;
    QList<QString> *mSupportivePathList=NULL;
    QString mLicenseName = "";



};

class Event{
public:
    Event(QString EventName,QString MethodFilePath,QString DataFilePath){
        this->setEventName(EventName);
        this->setMethodFilePath(MethodFilePath);
        this->setDataFilePath(DataFilePath);
    }
    Event(){}
    void setEventName(QString EventName){mEventName = EventName;}
    void setMethodFilePath(QString MethodFilePath){mMethodFilePath = MethodFilePath;}
    void setDataFilePath(QString DataFilePath){mDataFilePath = DataFilePath;}
    QString getEventName(){return mEventName;}
    QString getMethodFilePath(){return mMethodFilePath;}
    QString getDataFilePath(){return mDataFilePath;}
private:
    QString mEventName="";
    QString mMethodFilePath="";
    QString mDataFilePath="";
};



#endif // PROJECTHANDLE_H
